<template>
  <view class="icon-input">
    <view class="t-icon" :class="'t-' + icon"></view>
    <input :type="type" :placeholder="placeholder" @input="$emit('input', $event.target.value)" />
    <slot name="code"></slot>
  </view>
</template>

<script>
export default {
  props: {
    type: {
      type: String,
      default: 'text'
    },
    placeholder: {
      type: String
    },
    icon: {
      type: String,
      required: true
    }
  }
}
</script>

<style lang="scss" scoped>
.icon-input {
  display: flex;
  align-items: center;
  margin: 0 auto;
  width: 630rpx;
  height: 120rpx;
  border-bottom: 1px solid #dfdfdf;
  view {
    margin: 0 20rpx;
    width: 42rpx;
    height: 40rpx;
  }
  input {
    flex: 1;
    height: 40rpx;
  }
}
</style>
